<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>快招</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/public/js/mui/css/mui.min.css">
    <link rel="stylesheet" href="/public/weixin/css/css/index.css">
    <link rel="stylesheet" href="/public/weixin/css/iconfont/iconfont.css" />
    <style>
        .mui-bar-nav{
            box-shadow: none;
        }
    </style>
</head>

<body>
    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" onclick="window.history.back();"></a>
        <h1 class="mui-title">合伙人</h1>
    </header>

    <div class="mui-content">
        <div class="own_user_center_top" id="user_head">
            <div class="own_user_center_headimg">
                <img src="<?php echo ($user["headimgurl"]); ?>" alt="">
            </div>
            <div class="own_user_center_name">
                <?php echo ($user["nickname"]); ?>
            </div>
            <div class="own_user_center_">
                <?php if(empty($user['id'])): ?>未加盟
                    <?php else: ?>
                    <?php echo C('USER_SH_STATE')[$user['state']]['dict_text']; endif; ?>
            </div>
        </div>

        <div class="mui-table-view" id="user_center">
            <div class="mui-table-view-cell " id="my_staff">
                <span class="iconfont">
                    &#xe792;
                </span>
                我的工友
                <span class="own_lt_number mui-badge mui-badge-danger" id="user_invite_count"><?php echo ($user["invite_count"]); ?></span>
            </div>
            <div class="mui-table-view-cell " id="my_money">
               <span class="iconfont">
                    &#xe7de;
                </span>
                我的钱包
                <span class="own_lt_number mui-badge mui-badge-danger" id="user_total_money"><?php echo ($user["total_money"]); ?></span>
            </div>
            <div class="mui-table-view-cell " id="user_detail">
                <span class="own_lt_icon iconfont">&#xe7b3;</span>
                个人信息
            </div>

            <div class="mui-table-view-cell " id="pick_point">
                <span class="own_lt_icon iconfont">&#xe781;</span>
                接车点
            </div>
        </div>
    </div>
    <script src="/public/js/mui/js/mui.js"></script>
    <script src="/public/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript">
        $(function(){
            var $user_invite_count = $('#user_invite_count');
            var $user_total_money = $('#user_total_money');
            var url = "<?php echo U('Coms/get_user_info_num');?>"+"&v="+Math.random();
            mui.ajax(url, {
                dataType: 'json',
                type: 'post',
                timeout: 0,
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    $user_invite_count.text(data['invite_count']);
                    $user_total_money.text(data['total_money']);
                },
                error: function(xhr, type, errorThrown) {
                    console.log(xhr);
                    console.log(type);
                    console.log(errorThrown);
                }
            });
        });
        mui("#user_center").on('tap', '#my_staff', function() {
            window.location.href = "<?php echo U('User/my_staff');?>";
        });
        mui("#user_center").on('tap', '#my_money', function() {
            window.location.href = "<?php echo U('User/my_money');?>";
        });
        mui("#user_center").on('tap', '#user_detail', function() {
            window.location.href = "<?php echo U('User/user_detail');?>";
        });

        mui("#user_head").on('tap', '.own_user_center_headimg', function() {
            window.location.href = "<?php echo U('User/user_detail');?>";
        });
        mui("#user_center").on('tap', '#pick_point', function() {
            window.location.href = "<?php echo U('User/pick_point');?>";
        });
    </script>
</body>

</html>